package com.eastcom.bm.atom;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

@Entity
@Table(name = "QA_METAL_KPI_BASE_DEFINE")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Atom_MetalKpiBase {

	private String id;
	
	private String cn_name;
	
	private String desc;
	
	private String businessId;
	
	private String type;
	
	private String subType;
	
	private String relatedKpis;

	private List<Atom_MetalKpiExpand> metalKpiExpands;
	
	@Id
	@Column(name="ID")
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	@Column(name="KPI_NAME_CN")
	public String getCn_name() {
		return cn_name;
	}

	public void setCn_name(String cn_name) {
		this.cn_name = cn_name;
	}

	@Column(name="KPI_DESC")
	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	@Column(name="BUSINESS_ID")
	public String getBusinessId() {
		return businessId;
	}

	public void setBusinessId(String businessId) {
		this.businessId = businessId;
	}

	@Column(name="SUB_TYPE")
	public String getSubType() {
		return subType;
	}

	public void setSubType(String subType) {
		this.subType = subType;
	}
	
	@Column(name="TYPE")
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
	
	@Column(name="RELATED_KPIS")
	public String getRelatedKpis() {
		return relatedKpis;
	}

	public void setRelatedKpis(String relatedKpis) {
		this.relatedKpis = relatedKpis;
	}

	@OneToMany(targetEntity=Atom_MetalKpiExpand.class,cascade={CascadeType.REMOVE},mappedBy="kpiBaseDefine",fetch=FetchType.LAZY)
	@Fetch(FetchMode.SUBSELECT)
	@JoinTable(name = "QA_METAL_KPI_EX_DEFINE", joinColumns = @JoinColumn(name = "KPI_ID",insertable=true) ,inverseJoinColumns = @JoinColumn(name = "ID",insertable=true))
	public List<Atom_MetalKpiExpand> getMetalKpiExpands() {
		return metalKpiExpands;
	}

	public void setMetalKpiExpands(List<Atom_MetalKpiExpand> metalKpiExpands) {
		this.metalKpiExpands = metalKpiExpands;
	}
	
}
